<template>
  <div class="banner">
      
<van-swipe class="my-swipe" :autoplay="3000" indicator-color="white"  @change="onChange">
  <van-swipe-item v-for="(page,index) in children.children" :key="index">
    <img :src="page.model.cover" alt="">
    <span>{{page.model.title}}</span>
    </van-swipe-item>
      <template #indicator>
    <div class="custom-indicator"><span class="index">{{ current + 1 }}</span>/<span>{{children.children.length}}</span></div>
  </template>
</van-swipe>


  </div>
</template>

<script>
import Vue from 'vue';
import { Swipe, SwipeItem } from 'vant';

Vue.use(Swipe);
Vue.use(SwipeItem);
export default {
props:["children"],
  data() {
    return {
      current: 0,
    };
  },
  methods: {
    onChange(index) {
      this.current = index;
    },
  },
}
</script>

<style lang="less" scoped>
.banner{
width: 96%;
margin: 5px 0;
  .custom-indicator {
    position: absolute;
    right: 5px;
    bottom: 5px;
    padding: 2px 5px;
    font-size: 12px;
    color: #fff;
    font-size: 14px;
    .index{
      font-size: 16px;
    }
  }



     .van-swipe-item {
    color: #fff;
    font-size: 20px;
    // line-height: 150px;
    text-align: center;
    background-color: #39a9ed;
    height: 200px;
    position: relative;
    border-radius: 10px;
    width: 100%;
 
    img{
        width: 100%;
        height: 100%;
        border-radius: inherit;
      
      
    }
    span{
      position: absolute;
      bottom: 5px;
      left: 20px;
      font-size: 15px;
      font-weight: 600;
    }
  }
}

</style>